#pragma once
#include <string>
#include <cstddef> 
#include <odb/nullable.hxx>
#include <odb/core.hxx>

// odb -d mysql --std c++11 --generate-query --generate-schema --profile boost/date-time friend_apply.hxx
namespace xchat
{
//好友申请表
#pragma db object table("friend_apply")
class FriendApply
{
public:
    FriendApply() {}
    //用户名--新增id -- 用户ID 昵称 密码
    FriendApply(const std::string &event_id, const std::string &user_id, const std::string &peer_id)
        :_event_id(event_id),_user_id(user_id), _peer_id(peer_id)
    {}
    std::string event_id() const { return _event_id; }
    void event_id(const std::string &val)  { _event_id = val; }
    
    std::string user_id() const { return _user_id; }
    void user_id(const std::string &val)  { _user_id = val; }
    
    std::string peer_id() const { return _peer_id; }
    void peer_id(const std::string &val)  { _peer_id = val; }

private:
    friend class odb::access;

    #pragma db id auto
    unsigned long _id;


    #pragma db type("varchar(64)") index unique
    std::string _event_id;
    #pragma db type("varchar(64)") index
    std::string _user_id;           //申请者
    #pragma db type("varchar(64)") index
    std::string _peer_id;           //申请目标

};

} // namespace xchat